//
//  ScanView.m
//  Scan
//
//  Created by Timmy on 16/8/17.
//  Copyright © 2016年 任雨婷. All rights reserved.
//

#import "ScanView.h"

#define mainBounds [UIScreen mainScreen].bounds

@implementation ScanView

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self addAllViews];
    }
    return self;
}


#pragma mark 界面布局
-(void)addAllViews
{
    self.lblStatus = [[UILabel alloc]initWithFrame:CGRectMake(20, 20, self.frame.size.width-20*2, 45)];
    self.lblStatus.backgroundColor = [UIColor lightGrayColor];
    [self addSubview:self.lblStatus];
    
    self.viewPreview = [[UIView alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(self.lblStatus.frame)+20, self.frame.size.width, 380)];
    self.viewPreview.backgroundColor = [UIColor lightGrayColor];
    [self addSubview:self.viewPreview];
    
    self.startBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    self.startBtn.frame = CGRectMake(mainBounds.size.width*4/6, mainBounds.size.height*7/8, 60, 45);
    self.startBtn.backgroundColor = [UIColor lightGrayColor];
    [self.startBtn setTitle:@"开始" forState:UIControlStateNormal];
    [self.startBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    [self addSubview:self.startBtn];
    
    self.flashButton = [UIButton buttonWithType:UIButtonTypeCustom];
    self.flashButton.frame = CGRectMake(mainBounds.size.width/6, mainBounds.size.height*7/8, 60, 45);
    self.flashButton.backgroundColor = [UIColor lightGrayColor];
    [self.flashButton setTitle:@"闪光灯" forState:UIControlStateNormal];
    [self addSubview:self.flashButton];
    
}


@end
